﻿using ReportDesignerServer.DataModel;
using ReportDesignerServer.DataModels;
using SqlSugar;

namespace ReportDesignerServer.Common
{
    public static class CreateTable
    {
        /// <summary>
        /// 加表
        /// </summary>
        public static void Work() 
        {

           return;
            var DB = new SqlSugarClient(new ConnectionConfig()
            {
                ConnectionString = "Data Source=NurseWork.db;",
                DbType = SqlSugar.DbType.Sqlite,
                IsAutoCloseConnection = true,
                InitKeyType = InitKeyType.Attribute
            });

            DB.CodeFirst.SetStringDefaultLength(255).InitTables(typeof(User));
            DB.CodeFirst.SetStringDefaultLength(255).InitTables(typeof(Role));
            DB.CodeFirst.SetStringDefaultLength(255).InitTables(typeof(UserRole));
            DB.CodeFirst.SetStringDefaultLength(255).InitTables(typeof(Menu));
            DB.CodeFirst.SetStringDefaultLength(255).InitTables(typeof(RoleMenu));
            DB.CodeFirst.SetStringDefaultLength(255).InitTables(typeof(DictData));
            //DB.CodeFirst.SetStringDefaultLength(255).InitTables(typeof(RtmsRecord));
            //DB.CodeFirst.SetStringDefaultLength(255).InitTables(typeof(PatientInHospital));

            return;
            // 创建表
            DB.CodeFirst.SetStringDefaultLength(255).InitTables(typeof(DictPrintModelDataSrc));
            //db.CodeFirst.SetStringDefaultLength(255).InitTables(typeof(DictPrintModelDataSrc));
            string sql = "insert into DICT_PRINT_MODEL_DATASRC (ID, PRINTMODELNAME, DATASOURCENAME, DATASOURCEENNAME, MODELREPX, MODELXRNAME, DATASRCNO, DATASRCTYPE, DATASETSQL, DATASOURCEBING, INTERFACECODE)\r\nvalues ('1', 'ONE', '基本信息', 'base', null, null, '1', '1', 'select ''18岁'' AGE from dual', 'select ''18岁'' AGE from dual', null);";
            DB.Ado.ExecuteCommand(sql);
            return;

        }
    }
}
